<?php
/* @var $this PushnoteController */
/* @var $model Pushnote */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'pushnote-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note"><?php echo yii::t('base','Fields with <span class="required">*</span> are required.');?></p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php //echo $form->labelEx($model,'create_user'); ?>
		<?php echo $form->hiddenField($model,'create_user',array('size'=>60,'maxlength'=>255,'value'=>User::model()->getUserName(Yii::app()->user->id))); ?>
		<?php //echo $form->error($model,'create_user'); ?>
	</div>

<div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'description'); ?>
		<?php echo $form->textArea($model,'description',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'description'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'content'); ?>
		<?php echo $form->textArea($model,'content',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'content'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'platform'); ?>
		<?php echo $form->dropDownList($model,'platform',array('2'=>'All','0'=>'android','1'=>'ios')); ?>
		<?php echo $form->error($model,'platform'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'application'); ?>
		<?php //echo $form->textField($model,'application',array('size'=>60,'maxlength'=>255)); ?>
		<?php //echo $form->dropDownList($model,'application',CHtml::listData( Application::model()->findAll(), 'application_id', 'application_name')  ); ?>
			<?php
			$arr = explode('|',$model->application);
			$result =Application::model()->findAll();
			$k=0;
			for($i=0; $i<count($result); $i++){
				for($j=0; $j<count($arr); $j++){
					if($arr[$j] == $result[$i]['application_id']){
						$k++;
					?>
					<input type="checkbox"  name="application[]" checked="checked" value="<?php echo $result[$i]['application_id'];?>" /><?php echo $result[$i]['application_name'];?>
					<?php
					}
					
				}
				if(($i+1)%5 == 0&&$i>=4){
						echo '</br >';
					}
				if($k == 0){
				?>
			<input type="checkbox"  name="application[]" value="<?php echo $result[$i]['application_id'];?>" /><?php echo $result[$i]['application_name'];?>	
		<?php
			}
			$k=0;
		}
		?>
		
		<?php echo $form->error($model,'application'); ?>
	</div>

	<div class="row">
		<?php //echo $form->labelEx($model,'remarks'); ?>
		<?php //echo $form->textField($model,'remarks',array('size'=>60,'maxlength'=>255)); ?>
		<?php //echo $form->error($model,'remarks'); ?>
	</div>

	<div class="row">
		<?php //echo $form->labelEx($model,'delete'); ?>
		<?php //echo $form->textField($model,'delete'); ?>
		<?php //echo $form->error($model,'delete'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? yii::t('base','Send') : yii::t('base','Save')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->